home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oh!X 2001 Spring
/
Oh!X 2001 Spring Special CD-ROM (Japan).7z
/
Oh!X 2001 Spring Special CD-ROM (Japan) (Track 1).bin
/
GALAXY
/
ohx5-2
/
inettest.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-05-28
|
767b
|
34 lines
// inettest.cpp
#include <stdio.h>
#include <windows.h>
#include <wininet.h>
#pragma comment(lib, "wininet.lib")
int main(int argc, char* argv[])
{
HINTERNET hInternet = InternetOpen("Agent", 0, NULL, NULL, 0);
HINTERNET hFile = InternetOpenUrl(hInternet, argv[1], NULL, NULL, 0, 0);
if (hFile == NULL)
{
fprintf(stderr, "file not found: %s", argv[1]);
InternetCloseHandle(hInternet);
return 1;
}
char c;
DWORD dwBytesToRead;
for (;;)
{
if (!InternetReadFile(hFile, &c, 1, &dwBytesToRead))
break;
if (dwBytesToRead != 1)
break;
putchar(c);
}
InternetCloseHandle(hFile);
InternetCloseHandle(hInternet);
return 0;
}